Make this public again, since it's occasionally useful. (#121128, Marco
authorMatthias Clasen <maclas@gmx.de>
Sun, 31 Aug 2003 23:36:37 +0000 (23:36 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 31 Aug 2003 23:36:37 +0000 (23:36 +0000)
2003-09-01  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make
this public again, since it's occasionally useful.  (#121128,
Marco Pesenti Gritti)

* gtk/gtkaction.c: Add an "is_important" property and propagate
it to toolitem proxies.  (#121058, Marco Pesenti Gritti)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/reference/ChangeLog
docs/reference/gtk/gtk-sections.txt
gtk/gtkaction.c
gtk/gtkuimanager.c
gtk/gtkuimanager.h

index 45abb964f66c7da115f3e4af9d30a1889314c64d..4fb5db4b7c204e688331be3ab299b65b64d9db96 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2003-09-01  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make
+       this public again, since it's occasionally useful.  (#121128,
+       Marco Pesenti Gritti)
+
+       * gtk/gtkaction.c: Add an "is_important" property and propagate
+       it to toolitem proxies.  (#121058, Marco Pesenti Gritti)
+
 Mon Sep  1 00:32:30 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * tests/testtoolbar.c (main): connect to "delete_event" so the
index 45abb964f66c7da115f3e4af9d30a1889314c64d..4fb5db4b7c204e688331be3ab299b65b64d9db96 100644 (file)
@@ -1,3 +1,12 @@
+2003-09-01  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make
+       this public again, since it's occasionally useful.  (#121128,
+       Marco Pesenti Gritti)
+
+       * gtk/gtkaction.c: Add an "is_important" property and propagate
+       it to toolitem proxies.  (#121058, Marco Pesenti Gritti)
+
 Mon Sep  1 00:32:30 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * tests/testtoolbar.c (main): connect to "delete_event" so the
index 45abb964f66c7da115f3e4af9d30a1889314c64d..4fb5db4b7c204e688331be3ab299b65b64d9db96 100644 (file)
@@ -1,3 +1,12 @@
+2003-09-01  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make
+       this public again, since it's occasionally useful.  (#121128,
+       Marco Pesenti Gritti)
+
+       * gtk/gtkaction.c: Add an "is_important" property and propagate
+       it to toolitem proxies.  (#121058, Marco Pesenti Gritti)
+
 Mon Sep  1 00:32:30 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * tests/testtoolbar.c (main): connect to "delete_event" so the
index 45abb964f66c7da115f3e4af9d30a1889314c64d..4fb5db4b7c204e688331be3ab299b65b64d9db96 100644 (file)
@@ -1,3 +1,12 @@
+2003-09-01  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make
+       this public again, since it's occasionally useful.  (#121128,
+       Marco Pesenti Gritti)
+
+       * gtk/gtkaction.c: Add an "is_important" property and propagate
+       it to toolitem proxies.  (#121058, Marco Pesenti Gritti)
+
 Mon Sep  1 00:32:30 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * tests/testtoolbar.c (main): connect to "delete_event" so the
index 45abb964f66c7da115f3e4af9d30a1889314c64d..4fb5db4b7c204e688331be3ab299b65b64d9db96 100644 (file)
@@ -1,3 +1,12 @@
+2003-09-01  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make
+       this public again, since it's occasionally useful.  (#121128,
+       Marco Pesenti Gritti)
+
+       * gtk/gtkaction.c: Add an "is_important" property and propagate
+       it to toolitem proxies.  (#121058, Marco Pesenti Gritti)
+
 Mon Sep  1 00:32:30 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * tests/testtoolbar.c (main): connect to "delete_event" so the
index 68420bc22fb8f5d6554ef05625f981c83f1ae1a2..2267b68ec37d108ceef94fffe3624a643ccbd745 100644 (file)
@@ -1,3 +1,7 @@
+2003-09-01  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtk-sections.txt: Add gtk_ui_manager_ensure_update.
+
 2003-08-31  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/Makefile.am (IGNORE_HFILES): Add gtktoggleactionprivate.h
index 87ca2c08d11641af035a8996dcb6101339c993ff..ba0dba947921c9bc21195a49c027390fa1ca5210 100644 (file)
@@ -1735,6 +1735,7 @@ gtk_ui_manager_add_ui_from_string
 gtk_ui_manager_add_ui_from_file
 gtk_ui_manager_remove_ui
 gtk_ui_manager_get_ui
+gtk_ui_manager_ensure_update
 <SUBSECTION Standard>
 GTK_TYPE_UI_MANAGER
 GTK_UI_MANAGER
index f1b9e0c6137421b326cac343521909fe7e699e87..2b1cb7646353f542cbf087927c2ef03f1a33d467 100644 (file)
@@ -51,10 +51,11 @@ struct _GtkActionPrivate
   gchar *tooltip;
   gchar *stock_id; /* icon */
 
-  guint sensitive : 1;
-  guint visible : 1;
-  guint label_set : 1;       /* these two used so we can set label */
+  guint sensitive       : 1;
+  guint visible         : 1;
+  guint label_set       : 1; /* these two used so we can set label */
   guint short_label_set : 1; /* based on stock id */
+  guint is_important    : 1;
 
   /* accelerator */
   GQuark accel_quark;
@@ -77,6 +78,7 @@ enum
   PROP_SHORT_LABEL,
   PROP_TOOLTIP,
   PROP_STOCK_ID,
+  PROP_IS_IMPORTANT,
   PROP_SENSITIVE,
   PROP_VISIBLE,
 };
@@ -196,6 +198,13 @@ gtk_action_class_init (GtkActionClass *klass)
                                                        _("The stock icon displayed in widgets representing this action."),
                                                        NULL,
                                                        G_PARAM_READWRITE));
+  g_object_class_install_property (gobject_class,
+                                  PROP_IS_IMPORTANT,
+                                  g_param_spec_boolean ("is_important",
+                                                        _("Is important"),
+                                                        _("Whether the action is considered important. When TRUE, toolitem proxies for this action show text in GTK_TOOLBAR_BOTH_HORIZ mode"),
+                                                        FALSE,
+                                                        G_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
                                   PROP_SENSITIVE,
                                   g_param_spec_boolean ("sensitive",
@@ -203,7 +212,6 @@ gtk_action_class_init (GtkActionClass *klass)
                                                         _("Whether the action is enabled."),
                                                         TRUE,
                                                         G_PARAM_READWRITE));
-
   g_object_class_install_property (gobject_class,
                                   PROP_VISIBLE,
                                   g_param_spec_boolean ("visible",
@@ -212,6 +220,7 @@ gtk_action_class_init (GtkActionClass *klass)
                                                         TRUE,
                                                         G_PARAM_READWRITE));
 
+
   /**
    * GtkAction::activate:
    * @action: the #GtkAction
@@ -242,6 +251,7 @@ gtk_action_init (GtkAction *action)
   action->private_data->short_label = NULL;
   action->private_data->tooltip = NULL;
   action->private_data->stock_id = NULL;
+  action->private_data->is_important = FALSE;
 
   action->private_data->sensitive = TRUE;
   action->private_data->visible = TRUE;
@@ -348,6 +358,9 @@ gtk_action_set_property (GObject         *object,
          g_object_notify (object, "short_label");
        }
       break;
+    case PROP_IS_IMPORTANT:
+      action->private_data->is_important = g_value_get_boolean (value);
+      break;
     case PROP_SENSITIVE:
       action->private_data->sensitive = g_value_get_boolean (value);
       break;
@@ -387,6 +400,9 @@ gtk_action_get_property (GObject    *object,
     case PROP_STOCK_ID:
       g_value_set_string (value, action->private_data->stock_id);
       break;
+    case PROP_IS_IMPORTANT:
+      g_value_set_boolean (value, action->private_data->is_important);
+      break;
     case PROP_SENSITIVE:
       g_value_set_boolean (value, action->private_data->sensitive);
       break;
@@ -593,18 +609,21 @@ connect_proxy (GtkAction *action,
     {
       /* toolbar button specific synchronisers ... */
 
-      /* synchronise the label */
       g_object_set (G_OBJECT (proxy),
                    "label", action->private_data->short_label,
                    "use_underline", TRUE,
+                   "stock_id", action->private_data->stock_id,
+                   "is_important", action->private_data->is_important,
                    NULL);
       g_signal_connect_object (action, "notify::short_label",
                               G_CALLBACK (gtk_action_sync_short_label),
-                              proxy, 0);
-      
-      g_object_set (G_OBJECT (proxy), "stock_id", action->private_data->stock_id, NULL);
+                              proxy, 0);      
       g_signal_connect_object (action, "notify::stock_id",
-                       G_CALLBACK (gtk_action_sync_property), proxy, 0);
+                              G_CALLBACK (gtk_action_sync_property), 
+                              proxy, 0);
+      g_signal_connect_object (action, "notify::is_important",
+                              G_CALLBACK (gtk_action_sync_property), 
+                              proxy, 0);
 
       g_signal_connect_object (proxy, "create_menu_proxy",
                               G_CALLBACK (gtk_action_create_menu_proxy),
index 89ceb34e0a369af132c8cd77ca057e64c3d66978..d1336a0a102c86cba6f3a486504d66cfdd3c5899 100644 (file)
@@ -134,7 +134,6 @@ static void  gtk_ui_manager_node_prepend_ui_reference (GtkUIManagerNode *node,
                                                       GQuark action_quark);
 static void  gtk_ui_manager_node_remove_ui_reference  (GtkUIManagerNode *node,
                                                       guint merge_id);
-static void  gtk_ui_manager_ensure_update  (GtkUIManager *self);
 
 
 enum 
@@ -1794,7 +1793,32 @@ gtk_ui_manager_queue_update (GtkUIManager *self)
   self->private_data->update_tag = g_idle_add ((GSourceFunc)do_updates, self);
 }
 
-static void
+
+/**
+ * gtk_ui_manager_ensure_update:
+ * @self: a #GtkUIManager
+ * 
+ * Makes sure that all pending updates to the UI have been completed.
+ *
+ * This may occasionally be necessary, since #GtkUIManager updates the 
+ * UI in an idle function. A typical example where this function is
+ * useful is to enforce that the menubar and toolbar have been added to 
+ * the main window before showing it:
+ * <informalexample>
+ * <programlisting>
+ * gtk_container_add (GTK_CONTAINER (window), vbox); 
+ * g_signal_connect (merge, "add_widget", 
+ *                   G_CALLBACK (add_widget), vbox);
+ * gtk_ui_manager_add_ui_from_file (merge, "my-menus");
+ * gtk_ui_manager_add_ui_from_file (merge, "my-toolbars");
+ * gtk_ui_manager_ensure_update (merge);  
+ * gtk_widget_show (window);
+ * </programlisting>
+ * </informalexample>
+ *
+ * Since: 2.4
+ **/
+void
 gtk_ui_manager_ensure_update (GtkUIManager *self)
 {
   if (self->private_data->update_tag != 0)
index 4ee64703703c0658a15ac899bb1a9f1eb85102ee..937d47112d059dcc13e9f1c89bc98b8b40eb18a2 100644 (file)
@@ -79,8 +79,6 @@ void           gtk_ui_manager_set_add_tearoffs    (GtkUIManager   *self,
                                                   gboolean        add_tearoffs);
 gboolean       gtk_ui_manager_get_add_tearoffs    (GtkUIManager   *self);
 
-/* these two functions will dirty all merge nodes, as they may need to
- * be connected up to different actions */
 void           gtk_ui_manager_insert_action_group (GtkUIManager   *self,
                                                   GtkActionGroup *action_group,
                                                   gint            pos);
@@ -109,4 +107,6 @@ void           gtk_ui_manager_remove_ui           (GtkUIManager   *self,
 
 gchar         *gtk_ui_manager_get_ui              (GtkUIManager   *self);
 
+void           gtk_ui_manager_ensure_update       (GtkUIManager   *self);
+
 #endif /* __GTK_UI_MANAGER_H__ */